home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / FROMUTS / UNIXLIB37B / test / c / fstattest < prev    next >
Text File  |  1992-02-10  |  908b  |  30 lines

  1. /* fstattest.c (c) Copyright 1990 H.Rogers */
  2.  
  3. /* This program tests the fstat() system call. */
  4. /* For full information on fstat(), read the appropriate entry
  5.  * in section 2 of the UNIX Programmer's Manual. */
  6.  
  7. #include <stdio.h>            /* standard I/O and UNIX */
  8. #include <time.h>            /* time functions */
  9.  
  10. #include "sys/stat.h"            /* file status */
  11. #include "unistd.h"            /* UNIX system calls */
  12.  
  13. int main()
  14. {
  15. struct stat buf[1];            /* file status structure */
  16.  
  17. fstat(1,buf);                /* get status of terminal */
  18. printf("dev: %d\n",buf->st_dev);
  19. printf("ino: %x\n",buf->st_ino);
  20. printf("mode: %o\n",buf->st_mode);
  21. printf("nlink: %d\n",buf->st_nlink);
  22. printf("uid: %d\n",buf->st_uid);
  23. printf("gid: %d\n",buf->st_gid);
  24. printf("rdev: %d\n",buf->st_rdev);
  25. printf("size: %x\n",buf->st_size);
  26. printf("atime: %s",ctime(&buf->st_atime));
  27. printf("mtime: %s",ctime(&buf->st_mtime));
  28. printf("ctime: %s",ctime(&buf->st_ctime));
  29. }
  30.